<%--
  Created by IntelliJ IDEA.
  User: Htao
  Date: 2018/5/4
  Time: 16:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>用户列表</title>

    <style type="text/css">

        html {
            background-color: aqua;
        }

        /*.list {*/
            /*position: absolute;*/
            /*top: 50%;*/
            /*left: 50%;*/
            /*margin: -150px 0 0 -150px;*/
            /*width: 300px;*/
            /*height: 300px;
            }*/


        .list h1 {
            color: #fff;
            text-shadow: 0 0 10px rgba(0, 0, 0, 0.96);
            letter-spacing: 1px;
            text-align: center;
        }
    </style>
<script>
        window.onload = function(){
            //2.为编号前面的复选框绑定一个鼠标单击事件
            document.getElementById("checkboxAll").onclick = function(){
                //3.获得下面所有的复选框
                var checkOnes = document.getElementsByName("ids");
                //4.遍历
                for(var i=0;i<checkOnes.length;i++){
                    //5.让这些复选框的选中状态与编号前面的复选框的选中状态一致
                    checkOnes[i].checked=this.checked;
                    //6.this代表当前操作的元素！
                }
            }
        }
    </script>
</head>
<body>

<div class="list">
    <h1>用户信息</h1>
    <table style="width: 1000px;margin-left: 25%;" border="1px" >

        <tr>
            <td style="width: 100px">全选/取消<input type="checkbox" id="checkboxAll" value="${user.id}"></td>
            <td>用户姓名</td>
            <td>用户年龄</td>
            <td>性别</td>
            <td>密码</td>
            <td>操作 <a href="javascript:void(0)" onclick="document.forms[0].submit()">删除</a></td>
        </tr>

        <form action="${pageContext.request.contextPath }/user/deleteUserAll" method="post">
        <c:forEach items="${userList}" var="user">
            <tr>
                <td><input type="checkbox" name="ids" value="${user.id}"></td>
                <td>${user.username }</td>
                <td>${user.age }</td>
                <td>${user.sex }</td>
                <td>${user.password }</td>

                <td><a href="${pageContext.request.contextPath }/user/gitUserEditUI?id=${user.id}">修改</a>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="${pageContext.request.contextPath }/user/deleteUserById?id=${user.id}">删除</a></td>
            </tr>
        </c:forEach>
        </form>

    </table>
</div>

</body>
</html>
